
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>浮动和定位 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Landen">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-toggle-chapters/toggle.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-image-captions/image-captions.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="变换、过渡、动画.html" />
    
    
    <link rel="prev" href="居中、省略、清浮.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../01html/html简介.html">
            
                <a href="../01html/html简介.html">
            
                    
                    HTML
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../01html/01html.html">
            
                <a href="../01html/01html.html">
            
                    
                    a链接、图片
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../01html/02html.html">
            
                <a href="../01html/02html.html">
            
                    
                    列表、表格、表单
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../01html/h5新增.html">
            
                <a href="../01html/h5新增.html">
            
                    
                    h5新增
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="css简介.html">
            
                <a href="css简介.html">
            
                    
                    CSS
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="居中、省略、清浮.html">
            
                <a href="居中、省略、清浮.html">
            
                    
                    居中、省略、清浮
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.2" data-path="浮动和定位.html">
            
                <a href="浮动和定位.html">
            
                    
                    浮动和定位
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="变换、过渡、动画.html">
            
                <a href="变换、过渡、动画.html">
            
                    
                    变换、过渡、动画
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="sass和rem.html">
            
                <a href="sass和rem.html">
            
                    
                    sass和rem
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="flex、media、栅格化.html">
            
                <a href="flex、media、栅格化.html">
            
                    
                    flex、media、栅格化
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../03js/js简介.html">
            
                <a href="../03js/js简介.html">
            
                    
                    JavaScript
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../03js/数据类型.html">
            
                <a href="../03js/数据类型.html">
            
                    
                    数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../03js/字符串.html">
            
                <a href="../03js/字符串.html">
            
                    
                    字符串
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../03js/数组.html">
            
                <a href="../03js/数组.html">
            
                    
                    数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../03js/回流和重绘.html">
            
                <a href="../03js/回流和重绘.html">
            
                    
                    回流和重绘
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../03js/浏览器的渲染过程.html">
            
                <a href="../03js/浏览器的渲染过程.html">
            
                    
                    浏览器的渲染过程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../03js/十大排序算法.html">
            
                <a href="../03js/十大排序算法.html">
            
                    
                    十大排序算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../03js/对象的构建.html">
            
                <a href="../03js/对象的构建.html">
            
                    
                    对象的构建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../03js/this.html">
            
                <a href="../03js/this.html">
            
                    
                    this
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../03js/bind&call&apply.html">
            
                <a href="../03js/bind&call&apply.html">
            
                    
                    bind&call&apply
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../03js/函数.html">
            
                <a href="../03js/函数.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" data-path="../03js/变量提升.html">
            
                <a href="../03js/变量提升.html">
            
                    
                    变量提升
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.12" data-path="../03js/作用域.html">
            
                <a href="../03js/作用域.html">
            
                    
                    作用域
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.13" data-path="../03js/对象.html">
            
                <a href="../03js/对象.html">
            
                    
                    对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.14" data-path="../03js/存储.html">
            
                <a href="../03js/存储.html">
            
                    
                    存储
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.15" data-path="../03js/事件.html">
            
                <a href="../03js/事件.html">
            
                    
                    事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.16" data-path="../03js/图片预览.html">
            
                <a href="../03js/图片预览.html">
            
                    
                    图片预览
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.17" data-path="../03js/防抖节流.html">
            
                <a href="../03js/防抖节流.html">
            
                    
                    防抖节流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.18" data-path="../03js/同步异步.html">
            
                <a href="../03js/同步异步.html">
            
                    
                    同步异步
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.19" data-path="../03js/babel入门.html">
            
                <a href="../03js/babel入门.html">
            
                    
                    babel入门
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.20" data-path="../03js/nvm.html">
            
                <a href="../03js/nvm.html">
            
                    
                    nvm
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.21" data-path="../03js/ES6.html">
            
                <a href="../03js/ES6.html">
            
                    
                    ES6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.22" data-path="../03js/ES6-ES11.html">
            
                <a href="../03js/ES6-ES11.html">
            
                    
                    ES6-ES11
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >浮动和定位</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
                                <section class="normal markdown-section">
                                
                                <h2 id="&#x6D6E;&#x52A8;">&#x6D6E;&#x52A8;</h2>
<pre><code>&#x8BBE;&#x8BA1;&#x521D;&#x8877;---&#x6587;&#x5B57;&#x73AF;&#x7ED5;&#x56FE;&#x7247;
&#x540E;&#x6765;---&#x5927;&#x91CF;&#x5E94;&#x7528;&#x5728;&#x5E03;&#x5C40;&#x5F53;&#x4E2D;
</code></pre><ul>
<li>&#x539F;&#x7406;</li>
<li>&#x6587;&#x6863;&#x6D41;---&#x5143;&#x7D20;&#x4ECE;&#x5DE6;&#x5230;&#x53F3; &#x4ECE;&#x4E0A;&#x5230;&#x4E0B; &#x8FDB;&#x884C;&#x6392;&#x5217;</li>
<li>&#x8131;&#x79BB;&#x6587;&#x6863;&#x6D41;&#x7684;&#x6548;&#x679C;</li>
<li>&#x7279;&#x70B9;&#xFF1A;</li>
<li>&#x8131;&#x79BB;&#x6587;&#x6863;&#x6D41;</li>
<li>&#x6D6E;&#x52A8;&#x5143;&#x7D20;&#xFF0C;&#x5C3A;&#x5BF8;&#x6700;&#x597D;&#x662F;&#x4E00;&#x5B9A;&#x7684;&#xFF0C;&#x5C31;&#x662F;&#x5BBD;&#x9AD8;&#x662F;&#x56FA;&#x5B9A;&#xFF0C;&#x5426;&#x5219;&#x5C31;&#x4F1A;&#x5F15;&#x53D1;&#x2018;&#x4E00;&#x50CF;&#x7D20;&#x8840;&#x6848;&#x2019;</li>
<li>&#x4F7F;&#x5F97;&#x6D6E;&#x52A8;&#x5143;&#x7D20;&#x5171;&#x884C;</li>
<li>float&#x6D6E;&#x52A8;&#x4F7F;&#x5F97;vertical-algin&#x5931;&#x6548;</li>
<li>&#x6CE8;&#x610F;</li>
<li>&#x5F53;&#x76D2;&#x5B50;&#x6CA1;&#x6709;&#x5B9A;&#x4F4D;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x5C31;&#x76F4;&#x63A5;&#x6DFB;&#x52A0;&#x76F8;&#x5BF9;&#x5B9A;&#x4F4D;</li>
<li>&#x5982;&#x679C;li&#x91CC;&#x9762;&#x6709;&#x5B9A;&#x4F4D;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x5219;&#x5229;&#x7528;z-index&#x53BB;&#x63D0;&#x9AD8;&#x4F18;&#x5148;&#x7EA7;</li>
</ul>
<h2 id="display-inline-block&#x7684;&#x5E03;&#x5C40;&#x4F18;&#x7F3A;&#x70B9;">display: inline-block&#x7684;&#x5E03;&#x5C40;&#x4F18;&#x7F3A;&#x70B9;</h2>
<ul>
<li>&#x4F18;&#x70B9;&#xFF1A;</li>
<li>&#x89E3;&#x51B3;&#x4E86;&#x5143;&#x7D20;&#x5171;&#x884C;&#x7684;&#x95EE;&#x9898;</li>
<li>&#x52A8;&#x6001;&#x53BB;&#x8BBE;&#x7F6E;&#x5143;&#x7D20;&#x7684;&#x5BBD;&#x9AD8;</li>
<li>&#x7F3A;&#x70B9;&#xFF1A;</li>
<li>&#x5BB9;&#x5668;&#x5BBD;&#x5EA6;&#xFF0C;&#x5BB9;&#x6613;&#x53D7;&#x5230;&#x7A7A;&#x767D;&#x8282;&#x70B9;&#x5F71;&#x54CD;</li>
<li>&#x663E;&#x793A;&#x6587;&#x5B57;&#x7684;&#x5BB9;&#x5668;&#x4E2D;&#x590D;&#x5199;font-size&#x5C5E;&#x6027;</li>
<li>&#x8BBE;&#x7F6E;vertical-align: top; &#x9632;&#x6B62;&#x5143;&#x7D20;&#x5782;&#x76F4;&#x65B9;&#x5411;&#x4E0D;&#x5BF9;&#x9F50;</li>
<li>&#x5143;&#x7D20;&#x9700;&#x8981;&#x4E24;&#x7AEF;&#x5BF9;&#x9F50;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x8BBE;&#x7F6E;&#x5176;&#x4E2D;&#x4E00;&#x7AEF;&#x7684;&#x5BBD;&#x5EA6;&#x6216;&#x8005;&#x7528;&#x5916;&#x8FB9;&#x8DDD;&#x9876;&#x8FC7;&#x53BB;&#xFF0C;&#x5BFC;&#x81F4;&#x65E0;&#x6CD5;&#x7075;&#x6D3B;&#x7684;&#x5B9E;&#x73B0;&#x4E24;&#x7AEF;&#x5BF9;&#x9F50;</li>
</ul>
<h2 id="&#x6E05;&#x9664;&#x6D6E;&#x52A8;">&#x6E05;&#x9664;&#x6D6E;&#x52A8;</h2>
<pre><code>1&#x3001;&#x989D;&#x5916;&#x6807;&#x7B7E;&#x53D1;  &#x6DFB;&#x52A0;clear&#x7684;div&#x6807;&#x7B7E;

2&#x3001;&#x7236;&#x7EA7;&#x5143;&#x7D20;&#x6DFB;&#x52A0;voerflow: hidden&#x5C5E;&#x6027;(&#x4E0D;&#x63A8;&#x8350;)
    &#x89E6;&#x53D1;BFC(&#x5757;&#x7EA7;&#x683C;&#x5F0F;&#x5316;&#x4E0A;&#x4E0B;&#x6587;)

3&#x3001;&#x4F7F;&#x7528;after&#x4F2A;&#x7C7B;&#x5143;&#x7D20;(&#x63A8;&#x8350;&#x4F7F;&#x7528;)
.clearfix::after{
    content:&quot;&quot;;
    display:block;
    height:0;
    clear:both;
    visibility:hidden;
}

4&#x3001;&#x7ED9;&#x7236;&#x5143;&#x7D20;&#x8BBE;&#x7F6E;&#x9AD8;&#x5EA6;
</code></pre><h2 id="&#x5B9A;&#x4F4D;">&#x5B9A;&#x4F4D;</h2>
<pre><code>1&#x3001;fixed &#x56FA;&#x5B9A;&#x5B9A;&#x4F4D;  &#x8131;&#x79BB;&#x6587;&#x6863;&#x6D41;
2&#x3001;relative &#x76F8;&#x5BF9;&#x5B9A;&#x4F4D;
3&#x3001;position &#x7EDD;&#x5BF9;&#x5B9A;&#x4F4D;
4&#x3001;static &#x9ED8;&#x8BA4;&#x503C;
</code></pre><h2 id="&#x4E0A;&#x4F20;git&#x56DB;&#x6B65;&#x8D70;">&#x4E0A;&#x4F20;git&#x56DB;&#x6B65;&#x8D70;</h2>
<pre><code>1&#x3001;git add .
2&#x3001;git commit -m &quot;&quot;
3&#x3001;git pull &#x89E3;&#x51B3;&#x51B2;&#x7A81;
4&#x3001;git push &#x4E0A;&#x4F20;
</code></pre><h2 id="&#x5176;&#x4ED6;">&#x5176;&#x4ED6;</h2>
<pre><code>    css:&#x5168;&#x79F0; &#x5C42;&#x53E0;&#x6837;&#x5F0F;&#x8868;
    &#x4F5C;&#x7528;:&#x7F8E;&#x5316;&#x9875;&#x9762; &#x7F51;&#x9875;&#x5316;&#x5986;&#x5E08;
    &#x76EE;&#x7684;&#xFF1A;&#x884C;&#x4E3A;  &#x8868;&#x73B0;&#x5206;&#x79BB;  &#x884C;&#x4E3A;-&gt;&#x7ED3;&#x6784;  html&#x6807;&#x7B7E;  &#x8868;&#x73B0;-&gt;css

    css3  ie9
    &#x6D4F;&#x89C8;&#x5668;&#x79C1;&#x6709;&#x524D;&#x7F00;
    ie  -ms-
    opera,360,&#x8C37;&#x6B4C;   -webkit-
    &#x706B;&#x72D0;   -Moz-
</code></pre>
                                
                                </section>
                            
                        </div>
                    </div>
                
            </div>

            
                
                <a href="居中、省略、清浮.html" class="navigation navigation-prev " aria-label="Previous page: 居中、省略、清浮">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="变换、过渡、动画.html" class="navigation navigation-next " aria-label="Next page: 变换、过渡、动画">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"浮动和定位","level":"1.3.2","depth":2,"next":{"title":"变换、过渡、动画","level":"1.3.3","depth":2,"path":"md/02css/变换、过渡、动画.md","ref":"./md/02css/变换、过渡、动画.md","articles":[]},"previous":{"title":"居中、省略、清浮","level":"1.3.1","depth":2,"path":"md/02css/居中、省略、清浮.md","ref":"./md/02css/居中、省略、清浮.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-search","-sharing","toggle-chapters","image-captions","-anchor-navigation","-anchor-navigation-ex"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"image-captions":{"attributes":{"style":"left: 50%;position: relative;transform: translateX(-50%);"},"caption":"图 _PAGE_LEVEL_._PAGE_IMAGE_NUMBER_ - _CAPTION_","align":"center","variable_name":"_pictures"},"fontsettings":{"theme":"night","family":"sans","size":2},"toggle-chapters":{},"highlight":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"Landen","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"_pictures":[]},"gitbook":"3.x.x"},"file":{"path":"md/02css/浮动和定位.md","mtime":"2020-06-08T12:16:11.344Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-08-17T10:41:18.504Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

